﻿using Services;

[assembly: WebActivator.PreApplicationStartMethod(typeof(DragonLibrary.AppStart.NinjectMVC3), "Start")]
[assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof(DragonLibrary.AppStart.NinjectMVC3), "Stop")]

namespace DragonLibrary.AppStart
{
    using Microsoft.Web.Infrastructure.DynamicModuleHelper;

    using Ninject;
    using Ninject.Web.Mvc;

    public static class NinjectMVC3
    {
        private static readonly Bootstrapper Bootstrapper = new Bootstrapper();

        /// <summary>
        /// Starts the application
        /// </summary>
        public static void Start()
        {
            DynamicModuleUtility.RegisterModule(typeof(OnePerRequestModule));
            Bootstrapper.Initialize(CreateKernel);
        }

        /// <summary>
        /// Stops the application.
        /// </summary>
        public static void Stop()
        {
            Bootstrapper.ShutDown();
        }

        /// <summary>
        /// Creates the kernel that will manage your application.
        /// </summary>
        /// <returns>The created kernel.</returns>
        private static IKernel CreateKernel()
        {
            var kernel = new StandardKernel();
            RegisterServices(kernel);
            return kernel;
        }

        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            //kernel.Bind<IConfigurationService>().To<ConfigurationService>();
            //kernel.Bind<ICompanyService>().To<CompanyService>();
            //kernel.Bind<IContractService>().To<ContractService>();
            //kernel.Bind<IDocumentImportService>().To<DocumentImportService>();
            //kernel.Bind<ISearchServise>().To<SearchServise>();
        }
    }
}
